#! /bin/sh
###########################################################################
#                          恢复被隐藏的tracked文件                        #
#                                                                         #
#  说明：恢复assume-unchanged的文件可见，即可以被git status检测到改变     #
#                                                                         #
#  此脚本只用于tracked的文件                                              #
#  使用方法：                                                             #
#            ./showall.sh                                                 #
#                  无参数                                                 #
#                                                                         #
###########################################################################
BASE_PATH=${PWD%/src*}'/'
DATE=$(date +'%Y-%m-%d %H:%M:%S')
echo '========================'${DATE}'========================' | tee -a ${BASE_PATH}hidelog.log
echo 'BASE_PATH: '${BASE_PATH} | tee -a ${BASE_PATH}hidelog.log
git ls-files -v ${BASE_PATH} | grep "^h" | sed 's/^..//' | sed 's/\ /\\ /g' | xargs -I FILE git update-index --no-assume-unchanged FILE || true | tee -a ${BASE_PATH}hidelog.log
echo '['$(date +'%Y-%m-%d %H:%M:%S')']: 完成！所有文件都解除了隐藏状态' | tee -a ${BASE_PATH}hidelog.log
echo -e '================================END================================\n' | tee -a ${BASE_PATH}hidelog.log
git status
exit 0
